using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_Group : Admin, IRequiresSessionState
{
	protected GridView GridView1;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(28))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "UserGroup");
			base.WriteRightErrMsg();
		}
		if (!base.IsPostBack)
		{
			this.BindList();
		}
	}
	protected void BindList()
	{
		GroupBll groupBll = new GroupBll(this.conn);
		this.GridView1.DataSource = groupBll.GetGroups();
		this.GridView1.DataBind();
	}
	protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
	{
		if (e.CommandName == "com_del")
		{
			int groupID = Convert.ToInt32(e.CommandArgument);
			GroupBll groupBll = new GroupBll(this.conn);
			int num = groupBll.CountGroup();
			if (num == 1)
			{
				this.WriteErrMsg("", Language.GetAdminMsg("UserGroup/GrouNumErr"), "");
			}
			int num2 = groupBll.CountMemberNumByGroupID(groupID);
			if (num2 > 0)
			{
				this.WriteErrMsg("", Language.GetAdminMsg("UserGroup/UserNumErr", num2.ToString()), "");
			}
			groupBll.DeleteGroup(groupID);
		}
		this.BindList();
	}
}
